package com.projectx.action.chat.GroupAnnocement;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.projectx.R;
import com.projectx.action.chat.GroupChatActivity;
import com.projectx.util.ActivityManage;

import java.util.ArrayList;
import java.util.List;

public class GroupDialogActivity extends AppCompatActivity {
    ImageView change,back;
    List<String> content=new ArrayList<String>();
    List<String> time=new ArrayList<String>();
    List<Bitmap> bitmaps;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityManage.addActivity("GroupDialogActivity",this);
        setContentView(R.layout.activity_groupdialog);
        try {
            getSupportActionBar().hide(); //去除标题栏
        } catch (NullPointerException e){
            Log.d("KMH","没有状态栏标题");
        }


        content.add("测试");
        time.add("2010");



        change=findViewById(R.id.change);
        back=findViewById(R.id.back);

       // 判断是否有修改公告权限
        if (true)
        {
            change.setVisibility(View.VISIBLE);
            change.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent=new Intent(GroupDialogActivity.this,AddAnnouncement.class);
                    startActivity(intent);
                }
            });
        }
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityManage.exitActivity("GroupDialogActivity");
            }
        });
        RecyclerView recyclerView=findViewById(R.id.recycler_view);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(new GroupdialogAdapter(this, content,bitmaps,time));
        recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));

    }

    @Override
    public void onBackPressed() {
        ActivityManage.exitActivity("GroupDialogActivity");
    }
}


